import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:meal/constant/antd_icons.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/route/route.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

class Payment extends StatefulWidget {
  const Payment({Key? key}) : super(key: key);

  @override
  State<Payment> createState() => _PaymentState();
}

class _PaymentState extends State<Payment> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
      appBar: ToolsUtils.getDefaultBrnAppBar(
        '收款详情',
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.all(Sizes.default20),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(Sizes.default10),
                  gradient: LinearGradient(colors: [
                    ColorsUtils.rgba(255, 110, 83, 1),
                    ColorsUtils.rgba(255, 110, 83, 1),
                    ColorsUtils.rgba(255, 143, 83, 1),
                    ColorsUtils.rgba(255, 143, 83, 1)
                  ], stops: const [
                    0,
                    0,
                    1.0,
                    1.0
                  ], begin: Alignment.topLeft, end: Alignment.bottomRight)),
              padding: const EdgeInsets.all(Sizes.default10),
              child: ListBody(
                children: [
                  Container(
                    height: Sizes.default40,
                    alignment: Alignment.center,
                    child: Text(
                      '+187.54',
                      style: StylesUtils.customTextStyle(fontSize: Sizes.default20),
                    ),
                  ),
                  Container(
                    alignment: Alignment.center,
                    margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                    child: Text(
                      '-- 已入账 --',
                      style: StylesUtils.customTextStyle(fontSize: Sizes.default13),
                    ),
                  ),
                  Container(
                    alignment: Alignment.centerLeft,
                    margin: const EdgeInsets.only(bottom: Sizes.default10),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('订单总收入',
                            style: StylesUtils.customTextStyle(fontSize: Sizes.default13)),
                        Text('1308.48',
                            style: StylesUtils.customTextStyle(fontSize: Sizes.default13))
                      ],
                    ),
                  ),
                  Container(
                    margin: const EdgeInsets.only(bottom: Sizes.default10),
                    alignment: Alignment.centerLeft,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('配送总收入',
                            style: StylesUtils.customTextStyle(fontSize: Sizes.default13)),
                        Text('40', style: StylesUtils.customTextStyle(fontSize: Sizes.default13))
                      ],
                    ),
                  ),
                  Container(
                    margin: const EdgeInsets.only(bottom: Sizes.default10),
                    alignment: Alignment.centerLeft,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        InkWell(
                          onTap: openGuide,
                          child: Text.rich(
                            TextSpan(
                                text: '平台补贴 ',
                                style: StylesUtils.customTextStyle(fontSize: Sizes.default13),
                                children: const [
                                  WidgetSpan(
                                      child: Icon(
                                        AntdIcons.questionCircle,
                                        color: Colors.white,
                                        size: Sizes.default15,
                                      ),
                                      alignment: PlaceholderAlignment.middle)
                                ]),
                          ),
                        ),
                        Text('79.48', style: StylesUtils.customTextStyle(fontSize: Sizes.default13))
                      ],
                    ),
                  ),
                  Container(
                    alignment: Alignment.centerLeft,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('对账时间', style: StylesUtils.customTextStyle(fontSize: Sizes.default13)),
                        Text('2023-01-18',
                            style: StylesUtils.customTextStyle(fontSize: Sizes.default13))
                      ],
                    ),
                  ),
                ],
              ),
            ),
            Container(
              margin: const EdgeInsets.only(left: Sizes.default20, right: Sizes.default20, bottom: Sizes.default20),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(Sizes.default10), color: Colors.white),
              padding: const EdgeInsets.symmetric(horizontal: Sizes.default15, vertical: Sizes.default10),
              child: ListBody(
                children: [
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('订单编号', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('14232964103521', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('订单金额', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('48', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('订单收入', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('10', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('配送费', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('2', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('平台补贴', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('2', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('下单时间', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('2023-01-12', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  InkWell(
                    onTap: () {
                      Get.toNamed(RouteGet.orderInfo);
                    },
                    child: SizedBox(
                      height: Sizes.default30,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('查看详情', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                          BrunoTools.getAssetSizeImage(
                              BrnAsset.iconRightArrow, Sizes.default16, Sizes.default16)
                        ],
                      ),
                    ),
                  )
                ],
              ),
            ),
            Container(
              margin: const EdgeInsets.only(left: Sizes.default20, right: Sizes.default20, bottom: Sizes.default20),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(Sizes.default10), color: Colors.white),
              padding: const EdgeInsets.symmetric(horizontal: Sizes.default15, vertical: Sizes.default10),
              child: ListBody(
                children: [
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('团购订单号', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('142042964100921', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('订单金额', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('205', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default30,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('订单收入', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                        Text('100', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),)
                      ],
                    ),
                  ),
                  InkWell(
                    onTap: () {
                      Get.toNamed(RouteGet.orderInfo);
                    },
                    child: SizedBox(
                      height: Sizes.default30,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('查看详情', style: StylesUtils.customTextStyle(color: ColorsUtils.color333),),
                          BrunoTools.getAssetSizeImage(
                              BrnAsset.iconRightArrow, Sizes.default16, Sizes.default16)
                        ],
                      ),
                    ),
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

  void openGuide() {}
}
